package protocol.JT808_2019;

import java.util.HashMap;

public class Handle808_2019JT02 implements IHandle808_2019JT {

    @Override
    public String handle(JT808_2019Cmd cmd) {
        byte subOrder = cmd.subOrder();

        switch (subOrder){
            case 0x00:
                return handle0200(cmd);
            case 0x01:
                return handle0201(cmd);
            default:
                return "808-2019:未匹配的命令字"+(cmd.readOrder()+","+cmd.subOrder());
        }
    }

    private String handle0201(JT808_2019Cmd cmd) {
        StringBuilder builder = new StringBuilder();
        builder.append("终端->平台:位置信息查询应答");
        builder.append("\r\n");

        builder.append("应答流水号:"+cmd.readWORD());
        builder.append("\r\n");

        JT808_2019Utils.handle0200ALL(builder,cmd);

        return builder.toString();
    }

    private String handle0200(JT808_2019Cmd cmd) {
        StringBuilder builder = new StringBuilder();
        builder.append("终端->平台:位置信息汇报");
        builder.append("\r\n");

        JT808_2019Utils.handle0200ALL(builder,cmd);

        return builder.toString();
    }
}
